#ifndef UPOPUPMENU
#define UPOPUPMENU

#include "UCallBack.h"
#include "UGLFont.h"

using namespace std;


struct TPopUpMenuEntry
		{
			string Text;
			function<void()> Function;

			TPopUpMenuEntry(string text, function<void()> FuncPointer)
				: Text(text), Function(FuncPointer) {};
		};

class TPopUpMenu
{
private:
	int Left, Top;
	int MaxTextWidth;
	int TotalStrHeight;
	int MouseIndex(int X, int Y);
	vector<TPopUpMenuEntry> Entries;
	TGLFontRef GLFont;
	void MouseMove	(int X, int Y, int mstate);
	void MouseDown	(int X, int Y, uint8 button);
	void MouseUp	(int X, int Y, uint8 button);
public:
	bool Enabled;
	TPopUpMenu();
	void PopUp(int X, int Y);
	void AddEntry(string Text, function<void()> Key);
	void EventHandle(SDL_Event event);
	void Draw(int X, int Y, int MState);


};
#endif
